//获取车间信息
$(function (){
	//获取车间
	$.ajax({
		url: '../sys/dept/getCJ',
		type: 'GET',
		success(res) {
			vm.workShopList = res.deptList;
            vm.q.workShopId =  res.deptList[0].deptId;
			//过去中间的概览信息
			vm.getBaseInfo()
			//初始换模具动态图概览
			var dom1 = document.getElementById("container2");
			vm.chartZhuangTaiFenBu = echarts.init(dom1)
			vm.getChartZhuangTaiFenBu()
			//获取车间故障top数
			var dom2 = document.getElementById('moldFaultClassifyTimesDiv');
			vm.faultItemTopCahrt = echarts.init(dom2);
			vm.getWorkShopFaullTop()

			//获取本日报修数 本日完成数 模具报修列表
			vm.getStarReport()

			//获取缸体开动率
			var dom3 = document.getElementById("operatingRateOne");
			vm.chartGangTi = echarts.init(dom3)
			vm.getChartGangti()
			//获取缸盖开动率
			var dom4 = document.getElementById("operatingRateTWo");
			vm.chartGangGai = echarts.init(dom4)
			vm.getChartGangGai()
			//获取模具机型
			vm.getMOldMOdel()
		}
	});


})

//确定点击button
function workSearch(){
	vm.getBaseInfo()
	vm.getStarReport()
	vm.getWorkShopFaullTop()
	vm.getChartZhuangTaiFenBu()
	vm.getChartGangti()
	vm.getChartGangGai()

}
/*重置按钮*/
function Reset(){
	vm.q.workShopId = vm.workShopList[0].deptId;
	vm.q.modelName = ''
	workSearch()
}
//定时30s刷新
$(function (){
	setInterval(function(){
		vm.getBaseInfo()
		vm.getStarReport()
		vm.getWorkShopFaullTop()
		vm.getChartZhuangTaiFenBu()
		vm.getChartGangti()
		vm.getChartGangGai()
	},30000)
})
var scn_data={
	    q:{
			workShopId:'',//工作车间id
			modelName:''//模具机型
		},//
	    chartZhuangTaiFenBu:'',//模具状态分布概览
	    chartGangTi:'',//缸体开动率
	    chartGangGai:'',//缸盖开动率
	    workShopList:[],//工作车间
	    mouldTyeList:[],//模具类型
	    chartZhuangTaiFenBuOption:{
			tooltip: {
				trigger: 'item'
			},
			color: ['#00b050', '#fabf8f', '#ffff00', '#ffc000', '#ffc000', '#52c9e6','#7030a0','#ff0000','#ff0000','#bfbfbf'],
			calculable : true,
			legend: {},
			label: {
				alignTo: 'edge',
				formatter: '{name|{b}}: {c}',
				minMargin: 5,
				edgeDistance: 10,
				lineHeight: 15,
				rich: {
					time: {
						fontSize: 10,
						color: '#999'
					}
				}
			},
			series : [
				{
					name:'模具状态',
					type:'pie',
					radius : [30, 75],
					center : ['50%', '45%'],
					data:[],
					label: {
						formatter: '{a|{a}}{abg|}\n{hr|}\n  {b|{b}：}{c}  {per|{d}%}  ',
						backgroundColor: '#F6F8FC',
						borderColor: '#8C8D8E',
						borderWidth: 1,
						borderRadius: 4,
						rich: {
							a: {
								color: '#6E7079',
								lineHeight: 22,
								align: 'center'
							},
							hr: {
								borderColor: '#8C8D8E',
								width: '100%',
								borderWidth: 1,
								height: 0
							},
							b: {
								color: '#4C5058',
								fontSize: 14,
								fontWeight: 'bold',
								lineHeight: 33
							},
							per: {
								color: '#fff',
								backgroundColor: '#4C5058',
								padding: [3, 4],
								borderRadius: 4
							}
						}
					},
				}
			]
		},
	    chartGangTiOption:{
			xAxis: {
			    type: 'category',
			    data: [],
			    axisLabel: {
			        textStyle: {
			            color: 'white',
			        },
					interval:0,rotate: 40
			    },
			    axisLine: {
			        lineStyle: {
			            color: 'white',
			            width: 3
			        }
			    },
			},
			grid: {
				top: '5%',
				left: '15%',
				right: '0',
				bottom: '20%'
			},
			legend: {
			    bottom: '0',
			    textStyle: {
			        color: 'white',
			    }
			},
			tooltip: {
			    trigger: 'axis'
			},
			yAxis: [
			    {
			        type: 'value',
			        axisLabel: {
			            formatter: '{value} %',
			            textStyle: {
			                color: 'white',
			            }
			        },
			        axisLine: {
			            show:true,
			            lineStyle: {
			                color: 'white',
			                width: 3
			            }
			        }
			    }
			],
			series: [
			    {
			        data: [],
			        type: 'bar',
			        showBackground: true,
			        itemStyle: {
			            normal: {
			                color: '#c55a11'
			            }
			        },
			        barWidth: '40%',
			        label: {
			            show: true,
			            position: 'inside',
			            formatter: '{c}%'
			        },
			        backgroundStyle: {
			            color: 'transparent'
			        }
			    }
			]
		},//缸体option
	    chartGangGaiOption:{
			xAxis: {
				type: 'category',
				data: [],
				axisLabel: {
					textStyle: {
						color: 'white',
					},
					interval:0,rotate: 40
				},
				axisLine: {
					lineStyle: {
						color: 'white',
						width: 3
					}
				}
			},
			grid: {
				top: '5%',
				left: '15%',
				right: '5%',
				bottom: '18%'
			},
			legend: {
				bottom: '0',
				textStyle: {
					color: 'white',
				}
			},
			tooltip: {
				trigger: 'axis'
			},
			yAxis: [
				{
					type: 'value',
					axisLabel: {
						formatter: '{value} %',
						textStyle: {
							color: 'white',
						}
					},
					axisLine: {
						show:true,
						lineStyle: {
							color: 'white',
							width: 3
						}
					}
				}
			],
			series: [
				{
					data: [],
					type: 'bar',
					showBackground: true,
					itemStyle: {
						normal: {
							color: '#c55a11'
						}
					},
					barWidth: '40%',
					label: {
						show: true,
						position: 'inside',
						formatter: '{c}%'
					},
					backgroundStyle: {
						color: 'transparent'
					}
				}
			]
		},//缸盖option
	    faultItemTopCahrt:'',//故障top数chart
	    faultItemTopChartOption:{
			toolbox: {
				show: true,
				trigger: 'axis',
				axisPointer: {            // 坐标轴指示器，坐标轴触发有效
					type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
				},
				formatter: function (params) {
					var tar = params[1];
					return tar.name + '<br/>' + tar.seriesName + ' : ' + tar.value;
				}
			},
			color: ['#00f6ff'],
			tooltip: {
				trigger: 'axis'
			},
			grid: {
				bottom: '30%',
				top:'5%',
				right:'0'
			},
			xAxis: [{
				type: 'category',
				data: ["模具维修", "更换芯型、馕件", "水管故障", "模具跑水", "燃烧室上浮", "更换密封条", "真空阀故障", "模具漏气", "卡缸套", "打磨放电"],
				axisLine: {
					lineStyle: {
						color: '#ccc'
					}
				},
				axisLabel: {interval:0,rotate: 40 },
			}],
			yAxis: [
				{
					type: 'value',
					minInterval: 1,
					axisLine: {
						lineStyle: {
							color: '#ccc'
						}
					},

				}
			],
			series: [
				{
					name: "故障次数",
					type: 'bar',
					data: [18, 10, 2, 1, 1, 1, 1, 1, 0, 0],
				}
			]
		},
		alarm:{alarm:10,fault:10},
		dtu:{ on:150,off:150},
		plc:{on:10,off:10},
		industy:{v1:10,v2:11,v3:12,v3:14,v4:15,v5:17,v6:18},
		online:{v1:10,v2:11,v3:12,v3:14,v4:15,v5:17,v6:18,v7:18,v8:18,v9:18},
		factoryHeader:[
	        {"categories":"模具号"},
	        {"categories":"报修时间"},
	        {"categories":"问题描述"},
			{"categories":"维修人员"},
	        {"categories":"工单进度"},
			{"categories":"恢复时间"},
			{"categories":"维修时长"}
    	],
		ticketList:[],
		moldStatusCssList:[
			{
				status: 1,
				desc:'量产',
				isActived: false,
				disabled: false,
				css: {
					'background-color': '#00b050',
					color: 'black'
				},
				cssBak:{
					'background-color': '#00b050',
					color: 'black'
				}
			},
			{
				status: 2,
				desc:'超寿命使用',
				isActived: false,
				disabled: false,
				css: {
					'background-color': '#fabf8f',
					color: 'black'
				},
				cssBak:{
					'background-color': '#fabf8f',
					color: 'black'
				}
			},
			{
				status: 3,
				desc:'试模',
				isActived: false,
				disabled: true,
				css: {
					'background-color': '#ffff00',
					color: 'black'
				},
				cssBak:{
					'background-color': '#ffff00',
					color: 'black'
				}
			},
			{
				status: 4,
				desc:'维护',
				isActived: false,
				disabled: false,
				css: {
					'background-color': '#ffc000',
					color: 'black'
				},
				cssBak:{
					'background-color': '#ffc000',
					color: 'black'
				}
			},
			{
				status: 5,
				desc:'维修',
				isActived: false,
				disabled: true,
				css: {
					'background-color': '#ffc000',
					color: 'black'
				},
				cssBak:{
					'background-color': '#ffc000',
					color: 'black'
				}
			},
			{
				status: 6,
				desc:'封存',
				isActived: false,
				disabled: false,
				css: {
					'background-color': '#52c9e6',
					color: 'black'
				},
				cssBak:{
					'background-color': '#52c9e6',
					color: 'black'
				}
			},
			{
				status: 7,
				desc:'外借',
				isActived: false,
				disabled: false,
				css: {
					'background-color': '#7030a0',
					color: 'black'
				},
				cssBak:{
					'background-color': '#7030a0',
					color: 'black'
				}
			},
			{
				status: 8,
				desc:'模具报废',
				isActived: false,
				disabled: false,
				css: {
					'background-color': '#ff0000',
					color: 'black'
				},
				cssBak:{
					'background-color': '#ff0000',
					color: 'black'
				}
			},
			{
				status: 9,
				desc:'镶块报废',
				isActived: false,
				disabled: false,
				css: {
					'background-color': '#ff0000',
					color: 'black'
				},
				cssBak:{
					'background-color': '#ff0000',
					color: 'black'
				}
			},
			{
				status: 10,
				desc:'配新镶块',
				isActived: false,
				disabled: false,
				css: {
					'background-color': '#bfbfbf',
					color: 'black'
				},
				cssBak:{
					'background-color': '#bfbfbf',
					color: 'black'
				}
			}
		],
		moldStatusDataList:[
			{
			  "id": "2b2c5d33e3f3471081f162a0d1eb0549",
			  "code": "JZ",
			  "name": "浇铸",
			  "children": [
				{
				  "id": "7efd3d9da01846c6ac6076dab6bc59f1",
				  "parentId": "2b2c5d33e3f3471081f162a0d1eb0549",
				  "code": "JZ-GG",
				  "name": "缸盖",
				  "children": [
					{
					  "id": "c1d3863b17ac4e6c96cfb7be730feca5",
					  "parentId": "7efd3d9da01846c6ac6076dab6bc59f1",
					  "code": "Z2-GG-NE15-1",
					  "moldStatus": 6,
					  "useNo": 30589,
					  "productModel": "NE15",
					  "moldPageCode": "NE15-1",
					  "moldStatusDesc": "备用"
					},
					{
					  "id": "af215049179645dc9862834f65a604f1",
					  "parentId": "7efd3d9da01846c6ac6076dab6bc59f1",
					  "code": "Z2-GG-NE15-2",
					  "moldStatus": 1,
					  "useNo": 31456,
					  "productModel": "NE15",
					  "moldPageCode": "NE15-2",
					  "moldStatusDesc": "在用"
					},
					{
					  "id": "868c8ecb26a840f6b638feb8979badd8",
					  "parentId": "7efd3d9da01846c6ac6076dab6bc59f1",
					  "code": "Z2-GG-NE15-3",
					  "moldStatus": 1,
					  "useNo": 31486,
					  "productModel": "NE15",
					  "moldPageCode": "NE15-3",
					  "moldStatusDesc": "在用"
					},
					{
					  "id": "86904e6bb7b540fd9349b2aa517729f4",
					  "parentId": "7efd3d9da01846c6ac6076dab6bc59f1",
					  "code": "Z2-GG-NE15-4",
					  "moldStatus": 1,
					  "useNo": 25243,
					  "productModel": "NE15",
					  "moldPageCode": "NE15-4",
					  "moldStatusDesc": "在用"
					},
					{
					  "id": "ee5dc35a9ae34c5eab69a22d98eff990",
					  "parentId": "7efd3d9da01846c6ac6076dab6bc59f1",
					  "code": "Z2-GG-NE15-5",
					  "moldStatus": 1,
					  "useNo": 24824,
					  "productModel": "NE15",
					  "moldPageCode": "NE15-5",
					  "moldStatusDesc": "在用"
					},
					{
					  "id": "6a6f34370fd743b1a4a1576f6a15d18c",
					  "parentId": "7efd3d9da01846c6ac6076dab6bc59f1",
					  "code": "Z2-GG-NE15-9",
					  "moldStatus": 1,
					  "useNo": 30945,
					  "productModel": "NE15",
					  "moldPageCode": "NE15-9",
					  "moldStatusDesc": "在用"
					},
					{
					  "id": "ab30cf479a5849228a5951a1635c19ab",
					  "parentId": "7efd3d9da01846c6ac6076dab6bc59f1",
					  "code": "Z2-GG-NE15-10",
					  "moldStatus": 1,
					  "useNo": 30866,
					  "productModel": "NE15",
					  "moldPageCode": "NE15-10",
					  "moldStatusDesc": "在用"
					},
					{
					  "id": "62f639ab7f9c425b9c7b7bcf7ab74bcb",
					  "parentId": "7efd3d9da01846c6ac6076dab6bc59f1",
					  "code": "Z2-GG-NE15-13",
					  "moldStatus": 1,
					  "useNo": 11404,
					  "productModel": "NE15",
					  "moldPageCode": "NE15-13",
					  "moldStatusDesc": "在用"
					},
					{
					  "id": "03ba606fbad6496a84935f576a34bc6a",
					  "parentId": "7efd3d9da01846c6ac6076dab6bc59f1",
					  "code": "Z2-GG-NE15-11",
					  "moldStatus": 1,
					  "useNo": 4389,
					  "productModel": "NE15",
					  "moldPageCode": "NE15-11",
					  "moldStatusDesc": "在用"
					},
					{
					  "id": "91f1921872c749a2b43e28f976915773",
					  "parentId": "7efd3d9da01846c6ac6076dab6bc59f1",
					  "code": "Z2-GG-NE15-14",
					  "moldStatus": 1,
					  "useNo": 4189,
					  "productModel": "NE15",
					  "moldPageCode": "NE15-14",
					  "moldStatusDesc": "在用"
					},
					{
					  "id": "e6071f122a934ca398b227d221581fff",
					  "parentId": "7efd3d9da01846c6ac6076dab6bc59f1",
					  "code": "Z2-GG-NE15-6",
					  "moldStatus": 1,
					  "useNo": 10759,
					  "productModel": "NE15",
					  "moldPageCode": "NE15-6",
					  "moldStatusDesc": "在用"
					},
					{
					  "id": "a18ebbe6433a43a9b01b0614b57a2cbd",
					  "parentId": "7efd3d9da01846c6ac6076dab6bc59f1",
					  "code": "Z2-GG-NE15-7",
					  "moldStatus": 9,
					  "useNo": 3727,
					  "productModel": "NE15",
					  "moldPageCode": "NE15-7",
					  "moldStatusDesc": "在用"
					},
					{
					  "id": "d56f0cf7e93a4a33b9133762a3fdf614",
					  "parentId": "7efd3d9da01846c6ac6076dab6bc59f1",
					  "code": "Z2-GG-NE15-8",
					  "moldStatus": 8,
					  "useNo": 4478,
					  "productModel": "NE15",
					  "moldPageCode": "NE15-8",
					  "moldStatusDesc": "在用"
					},
					{
					  "id": "2313b644dfde4660834008872816ed98",
					  "parentId": "7efd3d9da01846c6ac6076dab6bc59f1",
					  "code": "Z2-GG-NE15-12",
					  "moldStatus": 1,
					  "useNo": 11269,
					  "productModel": "NE15",
					  "moldPageCode": "NE15-12",
					  "moldStatusDesc": "在用"
					},
					{
					  "id": "26d9cf26f01e4c88b1f86f7a250969f6",
					  "parentId": "7efd3d9da01846c6ac6076dab6bc59f1",
					  "code": "Z2-GG-NE15-15",
					  "moldStatus": 5,
					  "useNo": 4440,
					  "productModel": "NE15",
					  "moldPageCode": "NE15-15",
					  "moldStatusDesc": "维修"
					},
					{
					  "id": "03fea12119dd4feda0fbd9ec0f5ef7e6",
					  "parentId": "7efd3d9da01846c6ac6076dab6bc59f1",
					  "code": "Z2-GG-NE15-16",
					  "moldStatus": 1,
					  "useNo": 3716,
					  "productModel": "NE15",
					  "moldPageCode": "NE15-16",
					  "moldStatusDesc": "在用"
					},
					{
					  "id": "d3d256f2f9894021ac2d4ce52d4f4386",
					  "parentId": "7efd3d9da01846c6ac6076dab6bc59f1",
					  "code": "Z2-GG-NE15-17",
					  "moldStatus": 1,
					  "useNo": 4091,
					  "productModel": "NE15",
					  "moldPageCode": "NE15-17",
					  "moldStatusDesc": "在用"
					},
					{
					  "id": "36dd336f1b524227a3e623c2834bf7c3",
					  "parentId": "7efd3d9da01846c6ac6076dab6bc59f1",
					  "code": "Z2-GG-NE15-18",
					  "moldStatus": 1,
					  "useNo": 4270,
					  "productModel": "NE15",
					  "moldPageCode": "NE15-18",
					  "moldStatusDesc": "在用"
					}
				  ]
				}
			  ]
			},
			{
			  "id": "925ac856e1b549108673004cacf22db6",
			  "code": "ZX",
			  "name": "制芯",
			  "children": [
				{
				  "id": "e5af5795133544df9502a176116ebd76",
				  "parentId": "925ac856e1b549108673004cacf22db6",
				  "code": "ZX-SSD",
				  "name": "上水道",
				  "children": [
					{
					  "id": "4daf3222436e49d2a427fe140d43df53",
					  "parentId": "e5af5795133544df9502a176116ebd76",
					  "code": "Z2-ZX-NE14-SSD-1",
					  "moldStatus": 2,
					  "useNo": 2212,
					  "productModel": "NE14",
					  "moldPageCode": "NE14-1",
					  "moldStatusDesc": "备用"
					},
					{
					  "id": "a54d9f1aa74e4619a995619adc192b60",
					  "parentId": "e5af5795133544df9502a176116ebd76",
					  "code": "Z2-ZX-NE15-SSD-1",
					  "moldStatus": 1,
					  "useNo": 7357,
					  "productModel": "NE15",
					  "moldPageCode": "NE15-1",
					  "moldStatusDesc": "在用"
					}
				  ]
				},
				{
				  "id": "b6306ee517ff4dbe8aa50c83bc8307cc",
				  "parentId": "925ac856e1b549108673004cacf22db6",
				  "code": "ZX-XSD",
				  "name": "下水道",
				  "children": [
					{
					  "id": "0814971d3f1545ab931755fc3b262a59",
					  "parentId": "b6306ee517ff4dbe8aa50c83bc8307cc",
					  "code": "Z2-ZX-NE14-XSD-1",
					  "moldStatus": 2,
					  "useNo": 1504,
					  "productModel": "NE14",
					  "moldPageCode": "NE14-1",
					  "moldStatusDesc": "备用"
					},
					{
					  "id": "8c12f727847d49b693e9acb1539cd33f",
					  "parentId": "b6306ee517ff4dbe8aa50c83bc8307cc",
					  "code": "Z2-ZX-NE15-XSD-1",
					  "moldStatus": 1,
					  "useNo": 5634,
					  "productModel": "NE15",
					  "moldPageCode": "NE15-1",
					  "moldStatusDesc": "在用"
					}
				  ]
				},
				{
				  "id": "410f26ecd0424ba8842002a1370d10ca",
				  "parentId": "925ac856e1b549108673004cacf22db6",
				  "code": "ZX-QD",
				  "name": "气道",
				  "children": [
					{
					  "id": "276d3be8f12a42e699633f42fb51b0fc",
					  "parentId": "410f26ecd0424ba8842002a1370d10ca",
					  "code": "Z2-ZX-NE14-QD-1",
					  "moldStatus": 2,
					  "useNo": 8376,
					  "productModel": "NE14",
					  "moldPageCode": "NE14-1",
					  "moldStatusDesc": "备用"
					},
					{
					  "id": "72ba862ebff54420a83033ab09890c46",
					  "parentId": "410f26ecd0424ba8842002a1370d10ca",
					  "code": "Z2-ZX-NE15-QD-1",
					  "moldStatus": 1,
					  "useNo": 0,
					  "productModel": "NE15",
					  "moldPageCode": "NE15-1",
					  "moldStatusDesc": "在用"
					}
				  ]
				},
				{
				  "id": "82118c003c73432caa74fd3067a38043",
				  "parentId": "925ac856e1b549108673004cacf22db6",
				  "code": "ZX-YD",
				  "name": "油道",
				  "children": [
					{
					  "id": "92b4fa4c9f604207b63f223bad7f8a85",
					  "parentId": "82118c003c73432caa74fd3067a38043",
					  "code": "Z2-ZX-NE14-YD-1",
					  "moldStatus": 1,
					  "useNo": 8461,
					  "productModel": "NE14",
					  "moldPageCode": "NE14-1",
					  "moldStatusDesc": "在用"
					},
					{
					  "id": "7c20104d3a6f4c2da0d53aef353e884e",
					  "parentId": "82118c003c73432caa74fd3067a38043",
					  "code": "Z2-ZX-NE15-YD-1",
					  "moldStatus": 1,
					  "useNo": 0,
					  "productModel": "NE15",
					  "moldPageCode": "NE15-1",
					  "moldStatusDesc": "在用"
					}
				  ]
				}
			  ]
			},
			{
			  "id": "45646da96afb44a1af8ea3fdf670cd63",
			  "code": "YZ",
			  "name": "压铸",
			  "children": [
				{
				  "id": "c0da7357d37b4cfc8957ba973e310c91",
				  "parentId": "45646da96afb44a1af8ea3fdf670cd63",
				  "code": "YZ-SXT",
				  "name": "上箱体",
				  "children": [
					{
					  "id": "0c486d4d83b240c3b057b9ae454dc60a",
					  "parentId": "c0da7357d37b4cfc8957ba973e310c91",
					  "code": "Z2-YZ-NE14-1",
					  "moldStatus": 6,
					  "useNo": 72241,
					  "productModel": "NE01",
					  "moldPageCode": "NE01-1",
					  "moldStatusDesc": "封存"
					},
					{
					  "id": "e5fc605211414d5daa7753ca2b980a7e",
					  "parentId": "c0da7357d37b4cfc8957ba973e310c91",
					  "code": "Z2-YZ-NE14-2",
					  "moldStatus": 6,
					  "useNo": 73275,
					  "productModel": "NE01",
					  "moldPageCode": "NE01-2",
					  "moldStatusDesc": "封存"
					},
					{
					  "id": "e09549a8ee7c44df9e8d26a76823b3d0",
					  "parentId": "c0da7357d37b4cfc8957ba973e310c91",
					  "code": "Z2-YZ-NE15-3",
					  "moldStatus": 6,
					  "useNo": 95767,
					  "productModel": "NE03",
					  "moldPageCode": "NE03-3",
					  "moldStatusDesc": "封存"
					},
					{
					  "id": "9e6232fd18f6446ab2136646158ae224",
					  "parentId": "c0da7357d37b4cfc8957ba973e310c91",
					  "code": "Z2-YZ-NE15-1",
					  "moldStatus": 6,
					  "useNo": 77854,
					  "productModel": "NE03",
					  "moldPageCode": "NE03-1",
					  "moldStatusDesc": "封存"
					},
					{
					  "id": "3d284abd25ad4c58b61031cb54736fc8",
					  "parentId": "c0da7357d37b4cfc8957ba973e310c91",
					  "code": "Z2-YZ-NE15-2",
					  "moldStatus": 6,
					  "useNo": 106652,
					  "productModel": "NE03",
					  "moldPageCode": "NE03-2",
					  "moldStatusDesc": "封存"
					},
					{
					  "id": "0eb977fdb79a442caf44d266ac7758df",
					  "parentId": "c0da7357d37b4cfc8957ba973e310c91",
					  "code": "Z2-YZ-NE15-4AC",
					  "moldStatus": 1,
					  "useNo": 27046,
					  "productModel": "NE04",
					  "moldPageCode": "NE04-4AC",
					  "moldStatusDesc": "在用"
					},
					{
					  "id": "21af0beda9d5440097521efabec51af6",
					  "parentId": "c0da7357d37b4cfc8957ba973e310c91",
					  "code": "Z2-YZ-NE15-2AC",
					  "moldStatus": 1,
					  "useNo": 59312,
					  "productModel": "NE04",
					  "moldPageCode": "NE04-2AC",
					  "moldStatusDesc": "在用"
					},
					{
					  "id": "a0bd0cec01ba45a78ae727013fbbb233",
					  "parentId": "c0da7357d37b4cfc8957ba973e310c91",
					  "code": "Z2-YZ-NE15-1AC",
					  "moldStatus": 5,
					  "useNo": 6965,
					  "productModel": "NE04",
					  "moldPageCode": "NE04-1AC",
					  "moldStatusDesc": "维修"
					},
					{
					  "id": "4368deabeaf8491db8228de6ed8fdc65",
					  "parentId": "c0da7357d37b4cfc8957ba973e310c91",
					  "code": "Z2-YZ-NE15-13AC",
					  "moldStatus": 2,
					  "useNo": 33,
					  "productModel": "NE04",
					  "moldPageCode": "NE04-13AC",
					  "moldStatusDesc": "备用"
					},
					{
					  "id": "954cab570d4b4875ab0aeb578852f74d",
					  "parentId": "c0da7357d37b4cfc8957ba973e310c91",
					  "code": "Z2-YZ-NE15-4",
					  "moldStatus": 6,
					  "useNo": 95484,
					  "productModel": "NE03",
					  "moldPageCode": "NE03-4",
					  "moldStatusDesc": "封存"
					},
					{
					  "id": "29bf6feb21564e2bb16c27bf44b1d8ad",
					  "parentId": "c0da7357d37b4cfc8957ba973e310c91",
					  "code": "Z2-YZ-NE15-5AC",
					  "moldStatus": 1,
					  "useNo": 77637,
					  "productModel": "NE04",
					  "moldPageCode": "NE04-5AC",
					  "moldStatusDesc": "在用"
					},
					{
					  "id": "ce7a789aefe64a35b2a4d4ef17ebd8cd",
					  "parentId": "c0da7357d37b4cfc8957ba973e310c91",
					  "code": "Z2-YZ-NE15-3AC",
					  "moldStatus": 1,
					  "useNo": 58937,
					  "productModel": "NE04",
					  "moldPageCode": "NE04-3AC",
					  "moldStatusDesc": "在用"
					},
					{
					  "id": "3e72318a8de74496a01e079ab28f3057",
					  "parentId": "c0da7357d37b4cfc8957ba973e310c91",
					  "code": "Z2-YZ-NE15-8AC",
					  "moldStatus": 9,
					  "useNo": 50982,
					  "productModel": "NE04",
					  "moldPageCode": "NE04-8AC",
					  "moldStatusDesc": "委外维修"
					},
					{
					  "id": "40a1307355b04831a97664d627072f63",
					  "parentId": "c0da7357d37b4cfc8957ba973e310c91",
					  "code": "Z2-YZ-NE15-11AC",
					  "moldStatus": 1,
					  "useNo": 22476,
					  "productModel": "NE04",
					  "moldPageCode": "NE04-11AC",
					  "moldStatusDesc": "在用"
					}
				  ]
				}
			  ]
			}
		  ],
		REPAIR_TICKET_STATUS: {1: '待维修', 2: '待维修', 3: '维修中', 4: '维修结束', 5: '完成', 6: '关闭'},
	};
var vm = new Vue({
	el: '#content',
	data: scn_data,
	created(){
		//初始化模具状态分布概览
	},
	methods: {

		/*获取模具机型*/
		getMOldMOdel(){
			$.ajax({
				url: "../moduleseries/queryAll",
				type: 'GET',
				success: function (res) {
					vm.mouldTyeList = res.list;
				}
			});
		},
		getColor(moldStatusData){
			// 标准寿命
			var stan = moldStatusData.lifeStandard;
			// 已使用次数
			var currentTime = moldStatusData.useNo;
			if(currentTime == null || currentTime == "" || stan == null || stan == ""){
				return '';
			}
			var ys = stan * 0.8;
			if(currentTime < ys){
				return '';
			}else if(currentTime >= stan){
				return 'reds';
			}else {
				return 'orgins';
			}
		},
		/*获取车间故障top*/
		getWorkShopFaullTop(){
			let url = '../mould/stat/faultClassifyTimes?dept='+this.q.workShopId+'&modelName='+vm.q.modelName
			$.ajax({
				url: url,
				type: 'GET',
				success(res) {
					let data = res;
					let options = {
						xAxis:[
							{
								data:data.faultClassifyTimesStatData.devNames
							}
						],
						series:[
							{
								data:data.faultClassifyTimesStatData.faultTimes
							}
						]
					}
					vm.faultItemTopCahrt.setOption(vm.faultItemTopChartOption)
					vm.faultItemTopCahrt.setOption(options)
				}
			});
		},
		/*获取模具状态分布*/
		getChartZhuangTaiFenBu(){
			let url = '../mould/stat/status?workshopId='+this.q.workShopId+'&modelName='+vm.q.modelName
			$.ajax({
				url: url,
				type: 'GET',
				success(res) {
					let data = res;
					let option = {
						tooltip: {
							trigger: 'item'
						},
						color: ['#00b050', '#fabf8f', '#ffff00', '#ffc000', '#ffc000', '#52c9e6','#7030a0','#ff0000','#ff0000','#bfbfbf'],
						series:[
							{
								type:'pie',
								center: ['50%', '55%'],
								radius:'30%',
								data:data.mouldStatusStat.seriesData,
								label: {
									formatter: '{hr|}\n  {b|{b}：}{c}  {per|{d}%}  ',

									borderColor: '#8C8D8E',
									borderWidth: 1,
									borderRadius: 4,
									rich: {
										hr: {
											borderColor: '#e56464',
											width: '100%',
											borderWidth: 1,
											height: 0
										},
										b: {
											color: 'white',
											fontSize: 12,
											lineHeight: 1
										},
										per: {
											color: '#fff',
											backgroundColor: '#4C5058',
											padding: [3, 3],
											borderRadius: 4
										}
									}
								},
							}
						]
					}

					vm.chartZhuangTaiFenBu.setOption(vm.chartZhuangTaiFenBuOption)
					vm.chartZhuangTaiFenBu.setOption(option,true)
				}
			});
		},
		/*获取缸体开动率
		* */
		getChartGangti(){
			let url = '../mould/stat/faultRate?workshopId='+this.q.workShopId+'&moldTypeId=c0da7357d37b4cfc8957ba973e310c91'
			$.ajax({
				url: url,
				type: 'GET',
				success(res) {
					let data = res;
					let option = {
						tooltip: {
							trigger: 'item'
						},
						xAxis:{
							data:data.statResult.monthlyList
						},
						series:[
							{
								type:'bar',
								data:data.statResult.faultRateList,
								type: 'bar',
								showBackground: true,
								itemStyle: {
									normal: {
										color: '#c55a11'
									}
								},
								barWidth: '40%',
								label: {
									show: true,
									position: 'top',
									formatter: '{c}%'
								},
								backgroundStyle: {
									color: 'transparent'
								}
							}
						]
					}
					vm.chartGangTi.setOption(vm.chartGangTiOption)
					vm.chartGangTi.setOption(option)
				}
			});
		},
		/*获取缸盖开动率*/
		getChartGangGai(){
			let url = '../mould/stat/faultRate?workshopId='+this.q.workShopId+'&moldTypeId=7efd3d9da01846c6ac6076dab6bc59f1'
			$.ajax({
				url: url,
				type: 'GET',
				success(res) {
					let data = res;
					let option = {
						tooltip: {
							trigger: 'item'
						},
						xAxis:{
							data:data.statResult.monthlyList
						},
						series:[
							{
								type:'bar',
								data:data.statResult.faultRateList,
								type: 'bar',
								showBackground: true,
								itemStyle: {
									normal: {
										color: '#c55a11'
									}
								},
								barWidth: '40%',
								label: {
									show: true,
									position: 'top',
									formatter: '{c}%'
								},
								backgroundStyle: {
									color: 'transparent'
								}
							}
						]
					}
					vm.chartGangGai.setOption(vm.chartGangGaiOption)
					vm.chartGangGai.setOption(option)
				}
			});
		},
		getBaseInfo(){
			var url = '../modulearchives/loadMoldStatusData?foundryWorkshopId='+this.q.workShopId
			if(this.q.modelName){
				url = url+'&productModel='+this.q.modelName
			}
			$.ajax({
				url: url,
				type: 'GET',
				success(res) {
					this.moldStatusDataList = [];
					vm.moldStatusDataList = res.moldStatusDataList;
				}
			});
		},
		/*获取本日报修数*/
		getStarReport(){
			let url = '../mould/stat/repair?workshopId='+this.q.workShopId
			if(vm.q.modelName){
				url += '&modelName='+vm.q.modelName
			}
			$.ajax({
				url: url,
				type: 'GET',
				success(res) {
					let data = res.mouldStatusStat;
					vm.alarm.alarm = data.uploadNum;
					vm.alarm.fault = data.completeNum;
					vm.ticketList = data.uploadList;
				}
			});
		},
		details: function() {

		},
		renderItem(modelName){
            for (var i = 0; i < this.moldStatusCssList.length; i++) {
                if(this.moldStatusCssList[i].status == modelName){
                    return this.moldStatusCssList[i].cssBak;
                }
            }
            return this.moldStatusCssList[0].cssBak;
        },
	}
})
